<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>类</title>
	</head>
	<body>
		<script type="text/javascript">
			function Parent(name) {
				this.name=name;
			}
			Parent.prototype.hello=function () {
				alert("我是Parent的原型里的方法")}
			function Child(name,age) {
				Parent.call(this,name);
				this.age=age;
			}
			Child.prototype.__proto__=Parent.prototype;
			var child1=new Child("孙悟空",500);
			var child2=new Child("猪八戒",300)
		    child1.hello();
		    console.log(child1.age,child1.name)	
		</script>
	</body>
</html>
